import { defHttp } from '@/utils/http/axios';
enum Api {
  getvmAPI = '/mv/vm/page',
  updateVmAPI = '/mv/vm/update',
}

//虚拟机
export function getvmAPI(params) {
  params['current'] = params.page;
  params['size'] = params.pageSize;
  return defHttp
    .post(
      {
        url: Api.getvmAPI,
        params,
      },
      {
        isTransformResponse: false,
      },
    )
    .then((res) => {
      const { records, total } = res.data;
      return {
        items: records, // 将数据列表赋值给 items
        total, // 直接使用 total
      };
    })
    .catch((err) => {
      console.log(err, '虚拟机');
    });
}
export function updateVmAPI(params) {
  return defHttp
    .post(
      {
        url: Api.updateVmAPI,
        params,
      },
      {
        isTransformResponse: false,
      },
    )
    .then((res) => {
      return res;
    })
    .catch((err) => {
      console.log(err, '修改虚拟机');
    });
}
